<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <title>简单的预约挂号管理</title>
    <link href="/static/css/bootstrap.css" rel="stylesheet">
    <link href="/static/css/all.css" rel="stylesheet">
    <style>
        body{font-size: 12px;}
        a:hover{text-decoration: none;
            background-color: #29282e;
            color: white;
        }

        a {
            font-size: 18px;
            color: white;
        }

        .menu2 a {
            font-size: 15px;
        }

        a.m22:hover {
            background-color: #212025;
            font-size: 16px;
            display: block;
        }

        #sidebar{
            padding: 0px 0px;
            background-color: #32323a;
        }

        .rwin a{
            color:#a3a0a0;
            background-color: white;
        }
        #main{

        }
        </style>
</head>
<body>
<div class="container">
    <div class="row">
        <!--左边侧边栏-->
        <div class="col-sm-2" id="sidebar">
            <p style="line-height: 50px;vertical-align: middle; text-align: center;font-weight: 600;font-size: 20px;background-color: #29282e;color: white;">医院挂号预约系统</p>
            <div class="navbar">
                <ul class="navbar-nav" id="navMenu" style="padding: 0px;">
                    {volist name='menu1' id='v0'}
                    <li style="width:100%;line-height:50px" class='navbar-brand'><a href="#sub{$v0.did}"
                    {if $i==2}
                    style="display:inline-block;width:100%;background-color:#29282e;"
                    {else}
                    style="display:inline-block;width:100%;"
                    {/if}
                    onclick="htb({$v0.did});" data-toggle="collapse">&nbsp;&nbsp;<span class="{$v0.icon_class}"></span>&nbsp;{$v0.label}&nbsp;&nbsp;<span id="tb{$v0.did}" class="fa fa-angle-down" style="float:right;padding: 20px 10px 0px 0px;"/></span></a>
                        <ul  id="sub{$v0.did}"
                             {if $i==2}
                             class="nav nav-link collapse show menu2" style="background-color: #29282e;padding: 0px"
                             {else}
                             class="nav nav-link collapse  menu2"
                             {/if}
                        data-parent="#navMenu" style="padding: 0px">
                        {foreach $menu2 as $v1}
                        {if $v1.parent_id==$v0.did}
                        <a class='m22' href="javascript:;"><li id="m2id{$v1.did}"
                         {if $v1.modal!=""}
                        data-toggle="modal" data-target="{$v1.modal}"
                         {/if}
                            {if $v1.did==22}
                            style="height:40px;line-height:40px;vertical-align: middle;background-color:#1890ff"
                            {else}
                            style="height:40px;line-height:40px; vertical-align: middle;"
                            {/if}
                            onclick="menuFire('{$v1.src}','{$v0.label}','{$v1.label}',this);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="{$v1.icon_class}"></span>&nbsp;{$v1.label}</li></a>
                    {/if}
                    {/foreach}

                </ul></li>
                {/volist}
                </ul>
            </div>
        </div>
        <div class="col-sm-10" id="main" style="color:#b7b8b7 ">
            <div class="row" style="background: rgba(220, 220, 220, 0.3)">
                <div class="col-sm-12 navbar navbar-inverse rwin" style="margin-right: 10px ">
                    <div class="navbar-header">
                        <a href="#" class="navbar-brand" onclick="ab();" style=""><span id="allScreen" class="fa fa-outdent"></span></a>
                    </div>
                    <ul class="nav navbar-nav">
                        <li><a href="/index.php/hospital/index" id="toggleFullscreen"><span class="fa fa-expand" ></span></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="#"><span class="far fa-user">{$admin}</span></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="/index.php/hospital/admin/logout"><span class="fa fa-sign-out"></span></a></li>
                    </ul>
                </div>
            </div>
            <div class="row">
                <div class="col-sm-12">
                    <!--表格-->
                    <div>
                        <div id="itemTitle" class="panel-heading"><span style='color:#1890ff'>医生档案</span>&nbsp;&nbsp;<span class="fa fa-angle-right"></span>&nbsp;&nbsp;医生信息</div>
                        <iframe  src="/index.php/hospital/booking/list" onload="resetMainHeight(this)" style="width:100%;height:100%;" frameborder="0" scrolling="0"></iframe>
                    </div>
                </div>
            </div> <!-- 第一行 -->
        </div>
    </div>
</div>
<script src="/static/js/jquery-3.4.1.min.js"></script>
<script src="/static/js/bootstrap.js"></script>
<script src="/static/js/bootbox.js"></script>
</body>
</html>
<script>
    //全屏
    $(document).ready(function() {
        $('#toggleFullscreen').click(function() {
            //实现代码
        });
    });
    // 重新设置主操作页面高度
    function resetMainHeight(obj){
        var height = parent.document.documentElement.clientHeight - 80;
        $(obj).parent('div').height(height);
        // $(obj).parent('div').width(1600);
    }

    // 菜单点击
    function menuFire(src,m1item,item,obj){
        $("[id^=m2id]").css("background-color","transparent");
        $(obj).css("background-color","#1890ff");
        $('iframe').attr('src',src);
        $("#itemTitle").html("<span style='color:#1890ff'>"+m1item + '</span>&nbsp;&nbsp;<span class="fa fa-angle-right"></span>&nbsp;&nbsp;' + item);

    }

    function htb(pid){
        t=$('#tb'+pid).attr('class');
        $("[id^=tb]").attr("class","fa fa-angle-down");
        $("[id^=tb]").parent().css('background-color','#32323a');
        if(t=='fa fa-angle-down'){
            $('#tb'+pid).attr('class','fa fa-angle-up');
            $('#sub'+pid).css('background-color','#29282e');
            $('#tb'+pid).parent().css('background-color','#29282e');
        }
    }

    function ab(){
        a=$("#sidebar").css("display");
        if(a=="block"){
            $("#allScreen").attr("class","fa fa-indent");
            $("#sidebar").css({"display":"none"});
            $("#main").attr("class","col-sm-12");
        }else{
            $("#allScreen").attr("class","fa fa-outdent");
            $("#sidebar").css({"display":"block"});
            $("#main").attr("class","col-sm-10");
        }
    }



</script>


<!-- //添加的模态框 -->
<div class="modal" id="insertdoctormodal">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <h3 class="modal-title">添加医生信息</h3>
                <button type="button" class="close" data-dismiss="modal">&times;</button>
            </div>
            <div class="modal-body">
                <form action="" id="addForm">
<!--                    <input type="hidden" id="id" name="id">-->
                    <div class="form-group">
                        <div class="row">
                            <div class="col-sm-6">
                                <label for="id">ID：</label>
                                <input type="text" class="form-control" id="id" name="doctorid">
                            </div>
                            <div class="col-sm-6">
                                <label for="xb">性别：</label>
                                <input type="text" class="form-control" id="xb" name="sex">
                            </div>
                        </div>
                        <div class="row">
                            <div class="col-sm-6">
                                <label for="name">姓名：</label>
                                <input type="text" class="form-control" id="name" name="doctorname">
                            </div>
                            <div class="col-sm-6">
                                <label for="age">年龄：</label>
                                <input type="text" class="form-control" id="age" name="age">
                            </div>
                        </div>
                        <div class="row">
                            <div class="col-sm-6">
                                <label for="zc">职称：</label>
                                <input type="text" class="form-control" id="zc" name="postlevel">
                            </div>
                            <div class="col-sm-6">
                                <label for="xl">学历学位：</label>
                                <input type="text" class="form-control" id="xl" name="education">
                            </div>
                        </div>
                        <div class="row">
                            <div class="col-sm-6">
                                <label for="xx">毕业院校：</label>
                                <input type="text" class="form-control" id="xx" name="ubiversity">
                            </div>
                            <div class="col-sm-6">
                                <label for="ks">所属科室：</label>
                                <select name="subjectid" id="ks" class="form-control">
                                    {foreach $m3 as $v3}
                                    <option value="{$v3.subjectid}">{$v3.subjectname}</option>
                                    {/foreach}
                                </select>
                            </div>
                        </div>
                        <div class="row">
                            <div class="col-sm-6">
                                <label for="zy">专业：</label>
                                <input type="text" class="form-control" id="zy" name="major">
                            </div>
                            <div class="col-sm-6">
                                <label for="gzsj">工作时间：</label>
                                <input type="date" class="form-control" id="gzsj" name="workdate">
                            </div>
                        </div>
                        <div class="row">
                            <div class="col-sm-12">
                                <label for="gy">个人简介：</label>
                                <textarea class="form-control" rows="3" id="gy" name="about"></textarea>
                            </div>
                        </div>
                    </div>
                </form>

            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-primary" data-dismiss="modal" onclick="add()">添加</button>

            </div>


        </div>

    </div>

</div>
<!--添加科室-->
<div class="modal" id="insertsubjectmodal">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <h3 class="modal-title">添加科室</h3>
                <button type="button" class="close" data-dismiss="modal">&times;</button>
            </div>
            <div class="modal-body">
                <form action="" id="addsubjectForm">
                    <!--                    <input type="hidden" id="id" name="id">-->
                    <div class="form-group">
                        <div class="row">
                            <div class="col-sm-4">
                                <label for="id">ID：</label>
                                <input type="text" class="form-control" id="id" name="subjectid">
                            </div>
                            <div class="col-sm-4">
                                <label for="name">科室名称：</label>
                                <input type="text" class="form-control" id="name" name="subjectname">
                            </div>
                            <div class="col-sm-4">
                                <label for="address">科室地址：</label>
                                <input type="text" class="form-control" id="address" name="address">
                            </div>
                        </div>
                    </div>
                </form>

            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-primary" data-dismiss="modal" onclick="addsubject()">添加</button>
            </div>
        </div>

    </div>

</div>
<div class="modal" id="insertdoctorusermodal">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <h3 class="modal-title">添加用户</h3>
                <button type="button" class="close" data-dismiss="modal">&times;</button>
            </div>
            <div class="modal-body">
                <form action="" id="adddoctoruserForm">
<!--                    <input type="hidden" id="id" name="id">-->
                    <div class="form-group">
                        <div class="row">
                            <div class="col-sm-6">
                                <label for="id">ID：</label>
                                <input type="text" class="form-control" id="id" name="id">
                            </div>
                            <div class="col-sm-6">
                                <label for="name">姓名：</label>
                                <input type="text" class="form-control" id="name" name="name">
                            </div>
                        </div>
                        <div class="row">
                        <div class="col-sm-6">
                            <label for="role">角色：</label>
                            <input type="text" class="form-control" id="role" name="role">
                        </div>
                            <div class="col-sm-6">
                                <label for="password">密码：</label>
                                <input type="text" class="form-control" id="password" name="password">
                            </div>
                    </div>
                    </div>
                </form>

            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-primary" data-dismiss="modal" onclick="adddoctoruser()">添加</button>
            </div>
        </div>

    </div>

</div>
<script>
    function add(){
        $.post("/index.php/hospital/booking/insert",$("#addForm").serialize(),function(res){
            if(res>0){
                bootbox.alert("添加成功",function(){
                    window.location.reload();
                });
            }else{
                bootbox.alert("添加失败");
            }

        })

    }
    function addsubject(){
        $.post("/index.php/hospital/booking/insertsubject",$("#addsubjectForm").serialize(),function(res){
            if(res>0){
                bootbox.alert("添加成功",function(){
                    window.location.reload();
                    // window.location.href = '/index.php/hospital/subject/list';
                });
            }else{
                bootbox.alert("添加失败");
            }

        })

    }
    function adddoctoruser(){
        $.post("/index.php/hospital/booking/insertdoctoruser",$("#adddoctoruserForm").serialize(),function(res){
            if(res>0){
                bootbox.alert("添加成功",function(){
                    window.location.reload();
                    // window.location.href = '/index.php/hospital/subject/list';
                });
            }else{
                bootbox.alert("添加失败");
            }

        })

    }
</script>
